#pragma once
#include <iostream>
#include "Comm.hpp"
class Client
{
public:
    Client():_fd(dfultfd)
    {}

    bool OpenPipeWrite()
    {
            _fd = OpenPipe(gForWrite);
            if(_fd < 0)
            {   
                std::cerr<< "open error" <<std::endl;
                return false;
            }
            return true;
    }

    //std::string *: 输出型参数
    //const std::string & :输入型参数
    //std::string &: 输入输出型参数
    int SendPipe(std::string &in)
    {
        return ::write(_fd, in.c_str(), in.size());
    }

    void closePipe()
    {
        ClosePipeHelper(_fd);
    }

    ~Client()
    {}
private:
    int _fd;
};